package com.firefly.dao.assembler.mc;

import com.firefly.dao.dao.mc.po.McRolePo;
import com.firefly.dao.dto.mc.McRoleDto;
import com.firefly.dao.vo.mc.McRoleVo;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2023/1/31
 **/
@Component
public class McRoleAssembler {
    public List<McRoleVo> getListVo(List<McRolePo> list) {
        List<McRoleVo> result = new ArrayList<>();
        list.forEach(item -> {
            McRoleVo tmp = new McRoleVo();
            tmp.setId(item.getId());
            tmp.setName(item.getName());
            tmp.setStatus(item.getStatus());
            result.add(tmp);
        });
        return result;
    }

    public McRoleVo getVo(McRolePo detail) {
        McRoleVo result = new McRoleVo();
        result.setId(detail.getId());
        result.setName(detail.getName());
        result.setStatus(detail.getStatus());
        return result;
    }

    public McRolePo getPo(McRoleDto detail) {
        McRolePo entity = new McRolePo();
        entity.setId(detail.getId());
        entity.setName(detail.getName());
        entity.setStatus(detail.getStatus());
        return entity;
    }
}
